package com.dalanmao.ceshi;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;

public class ChildView extends View {

	public ChildView(Context context) {
		super(context);
	}

	public ChildView(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	public ChildView(Context context, AttributeSet attrs, int defStyleAttr) {
		super(context, attrs, defStyleAttr);
	}

	public ChildView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
		super(context, attrs, defStyleAttr, defStyleRes);
	}

	@Override
	public boolean dispatchTouchEvent(MotionEvent event) {
		Log.i("Event", "ChildView:dispatchTouchEvent");
		return super.dispatchTouchEvent(event);
		// return true;
		/*
		 * true 事件会分发给当前 View 并由 dispatchTouchEvent 方法进行消费，停止向下分发 false
		 * 交给父控件onTouchEvent消费 默认值 当前View的onTouchEvent消费
		 */
	}
	

	@Override
	public boolean onTouchEvent(MotionEvent event) {
		Log.i("Event", "ChildView:onTouchEvent");
		return super.onTouchEvent(event);
		// return false;
		/*
		 * true 消费该事件???????????????/// 
		 * false 向上传递，父控件的onTouchEvent消费  
		 * 默认值 消费该事件
		 */
	}

}
